package cn.net.asiacom.entity;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.text.PDFTextStripper;

/**
 * 获取发票文件的原始内容
 */
public class Original {
    private PDDocument doc;
    private PDPage page;
    private PDFTextStripper stripper;
    public String fullText;

    public PDDocument getDoc() {
        return doc;
    }
    public void setDoc(PDDocument doc) {
        this.doc = doc;
    }

    public PDPage getPage() {
        return page;
    }
    public void setPage(PDPage page) {
        this.page = page;
    }

    public PDFTextStripper getStripper() {
        return stripper;
    }
    public void setStripper(PDFTextStripper stripper) {
        this.stripper = stripper;
    }

    public String getFullText() {
        return fullText;
    }
    public void setFullText(String fullText) {
        this.fullText = fullText;
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this.fullText);
        } catch (JsonProcessingException e) {
            return "Original {" +
                    "doc=" + doc +
                    ", page=" + page +
                    ", stripper=" + stripper +
                    ", fullText='" + fullText + '\'' +
                    '}';
        }
    }
}
